package pl.edu.agh.uddiProxy.server;

import java.util.Map;

public class CacheQuery {
	private String query;
	private Map<String, String> staticMap;
	private long time;

	public CacheQuery(String query, Map<String, String> staticMap) {
		super();
		this.query = query;
		this.staticMap = staticMap;
		time = System.currentTimeMillis();
	}

	public long getTime() {
		return time;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((staticMap == null) ? 0 : staticMap.hashCode());
		result = prime * result + ((query == null) ? 0 : query.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CacheQuery other = (CacheQuery) obj;
		if (staticMap == null) {
			if (other.staticMap != null)
				return false;
		} else if (!staticMap.equals(other.staticMap))
			return false;
		if (query == null) {
			if (other.query != null)
				return false;
		} else if (!query.equals(other.query))
			return false;
		return true;
	}

}
